home *** CD-ROM | disk | FTP | other *** search
- Path: iconet.hongkong.net!wong.yuk.wah%f18.n1000.z128
- From: wong.yuk.wah%f18.n1000.z128@iconet.hongkong.net (Wong Yuk Wah)
- Newsgroups: comp.lang.c
- Subject: Passing struct in para.
- Distribution: world
- Message-ID: <56d1d38a56d1d38a@iconet.hongkong.net>
- Date: Tue, 27 Feb 1996 16:49:00 HKT
- Organization: IcoNET (HONG KONG) <--> Internet gateway
- X-Mailer: MailGate 0.25+
- Reply-To: Wong Yuk Wah <Wong.Yuk.Wah%f18.n1000.z128@iconet.hongkong.net>
-
- -=> Quoting xiaoyi@mozart.bme.ohio-state.edu to All <=-
-
- Hi Wu,
-
- x> Can we pass the copy of a structure in the para. list?
-
- Yes, structure is like a normal variable, and it is passed by value
- under normal situations. For example,
-
- struct x {
- ...
- };
-
- typedef struct x X;
-
- void func(int, X);
-
- main()
- {
- int y;
- X z;
-
- /* plus some initialization */
-
- func(y, z);
- ...
- return 0;
- }
-
- void func(int a, X b)
- {
- ...
- }
-
- This will pass a copy of z to func, just as y does.
-
- Regards,
- Wong Yuk Wah
-
- ... This is not a tagline.
-
- * Origin: IcoNET <--> Internet/Usenet gateway, 128:1000/1 (128:1000/1)
-